package com.dewei.ling.ballsapp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;

import com.dewei.ling.ballsapp.R;

/**
 * Created by jet on 2018-10-12.
 */

public class PlayerActivity extends BaseActivity {
    private WebView mweb;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_player);
        initView();

    }

    private void initView() {
        mweb = (WebView) findViewById(R.id.mweb);

        Intent intent = getIntent();
        //String title = intent.getStringExtra("title");
        final String link = "http://nba.stats.qq.com/stats/?ptag=baidu.ald.rank.nba";
        //标题
        //getSupportActionBar().setTitle(title);
        //加载网页
        //支持javascript
        mweb.getSettings().setJavaScriptEnabled(true);
        //支持缩放
        mweb.getSettings().setSupportZoom(true);
        //控制器
        mweb.getSettings().setBuiltInZoomControls(true);
        //mac port
        //mweb.setWebChromeClient(new WebViewClient());
        //loading web
        mweb.loadUrl(link);
        //本地显示
        mweb.setWebViewClient(new android.webkit.WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                view.loadUrl(link);
                return true;
            }
        });
    }
}
